home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / AEspotLightEffects.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  6.7 KB  |  304 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //
  20. //  Creation Date:    May 10, 1997
  21. //  Author:        sw
  22. //
  23. //  Procedure Name:
  24. //    AEspotLightEffects
  25. //
  26. //  Description:
  27. //    Creates custom attribute editor controls for the spotLight Node
  28. //
  29. //  Input Value:
  30. //    nodeName
  31. //
  32. //  Output Value:
  33. //    None
  34. //
  35.  
  36.  
  37.  
  38. //
  39. //  Procedure Name:
  40. //    AEdecayRegionNew
  41. //
  42. //
  43.  
  44. global proc AEdecayRegionNew(string $intensity)
  45. //
  46. // Description:
  47. //        Setup up button that makes decay regions.
  48. //
  49. {
  50.     setUITemplate -pst attributeEditorTemplate;
  51.     rowLayout -nc 3;
  52.             text -l "Intensity Curve";
  53.         button -l "Create" 
  54.             -c ("AEmakeDecayRegion " + $intensity) dr;
  55.         symbolButton -i "inArrow.xpm" 
  56.             -c ("AEintensityCurvePointer " + $intensity) intensityPointer;
  57.         setParent ..;
  58.     setUITemplate -ppt;
  59. }
  60.  
  61. //
  62. //  Procedure Name:
  63. //    AEdecayRegionReplace
  64. //
  65. //
  66.  
  67. global proc AEdecayRegionReplace(string $intensity)
  68. //
  69. // Description:
  70. //        Replace the button with the command to create 
  71. //        decay regions for the new light.
  72. //
  73. {
  74.     button -e -c ("AEmakeDecayRegion " + $intensity) dr;
  75.     button -e -c ("AEintensityCurvePointer " + $intensity) intensityPointer;
  76. }
  77.  
  78. //
  79. //  Procedure Name:
  80. //    AEmakeCurve
  81. //
  82. //
  83.  
  84. global proc string AEmakeCurve(string $curveName)
  85. {
  86.     // create the param curve.
  87.     string $newCurve = `createNode animCurveUU -n $curveName`;
  88.  
  89.     // set a few keyframes for the curve.
  90.     setKeyframe -f 0 -v 1     $newCurve;
  91.     setKeyframe -f 10 -v 0     $newCurve;
  92.     setKeyframe -f 20 -v 1     $newCurve;
  93.     setKeyframe -f 30 -v 0     $newCurve;
  94.     setKeyframe -f 40 -v 1     $newCurve;
  95.     setKeyframe -f 50 -v 0     $newCurve;
  96.     setKeyframe -f 60 -v 1     $newCurve;
  97.     setKeyframe -f 100 -v 0 $newCurve;
  98.  
  99.     return $newCurve;
  100. }    
  101.  
  102. //
  103. //  Procedure Name:
  104. //    AEmakeDecayRegion
  105. //
  106. //
  107.  
  108. global proc AEmakeDecayRegion(string $intensity)
  109. //
  110. // Description:
  111. //        Make a decay region for this light.
  112. //
  113. {
  114.     // get the name of the light.
  115.     string $lightName[];
  116.     tokenize($intensity, ".", $lightName);
  117.  
  118.     string $newCurve = AEmakeCurve("IntensityCurve");
  119.     string $attr = $newCurve + ".output";
  120.  
  121.     // connect the param curve to the intensity
  122.     connectAttr $attr $intensity;
  123.  
  124.     // create a lightInfo node.
  125.     string $lightInfoNode = `createNode lightInfo -n lightInfo`;
  126.  
  127.     // connect the light to the lightInfo node.    
  128.     $attr =     $lightName[0] + ".worldMatrix";
  129.     $attr2 =     $lightInfoNode + ".worldMatrix";
  130.     connectAttr $attr $attr2;
  131.  
  132.     // connect the lightInfoNode to the curve.
  133.     $attr =     $lightInfoNode + ".sampleDistance";
  134.     $attr2=        $newCurve + ".input";
  135.     connectAttr $attr $attr2;
  136. }
  137.  
  138. //
  139. //  Procedure Name:
  140. //    AEintensityCurvePointer
  141. //
  142. //
  143.  
  144. global proc AEintensityCurvePointer (string $name)
  145. {
  146.     string $intensityCurve[] = `listConnections $name`;
  147.     select $intensityCurve[0];
  148.     editSelected;
  149. }
  150.  
  151.  
  152. //
  153. //  Procedure Name:
  154. //     AEcolorRegionNew
  155. //
  156. //
  157.  
  158. global proc AEcolorRegionNew (string $colorR,string $colorG,string $colorB)
  159. //
  160. // Description:
  161. //        Setup up button that makes colour regions.
  162. //
  163. {
  164.     setUITemplate -pst attributeEditorTemplate;
  165.     rowLayout -nc 2;
  166.             text -l "Color Curves";
  167.         button -l "Create" 
  168.             -c ("AEmakeColorRegion " + $colorR + " " +
  169.                  $colorG + " " + $colorB ) colorRegion;
  170.         setParent ..;
  171.     setUITemplate -ppt;
  172. }
  173.  
  174. //
  175. //  Procedure Name:
  176. //    AEcolorRegionReplace
  177. //
  178. //
  179.  
  180. global proc AEcolorRegionReplace (string $colorR, string $colorG, string $colorB)
  181. //
  182. // Description:
  183. //        Replace the button with the command to create 
  184. //        colour regions for the new light.
  185. //
  186. {
  187.     button -e -c ("AEmakeColorRegion " + $colorR + " " +
  188.                  $colorG + " " + $colorB ) colorRegion;
  189. }
  190.  
  191. //
  192. //  Procedure Name:
  193. //    AEmakeColorRegion
  194. //
  195. //
  196.  
  197. global proc AEmakeColorRegion(string $colorR,string $colorG,string $colorB)
  198. //
  199. // Description:
  200. //        Make a color region for this light.
  201. //
  202. {
  203.     // get the name of the light.
  204.     string $lightName[];
  205.     tokenize($colorR, ".", $lightName);
  206.  
  207.     string $newCurveR = AEmakeCurve("RedCurve");
  208.     string $attrR = $newCurveR + ".output";
  209.  
  210.     string $newCurveG = AEmakeCurve("GreenCurve");
  211.     string $attrG = $newCurveG + ".output";
  212.  
  213.     string $newCurveB = AEmakeCurve("BlueCurve");
  214.     string $attrB = $newCurveB + ".output";
  215.  
  216.     // connect the param curve to the colour
  217.     connectAttr $attrR $colorR;
  218.     connectAttr $attrG $colorG;
  219.     connectAttr $attrB $colorB;
  220.  
  221.     // create a lightInfo node.
  222.     string $lightInfoNode = `createNode lightInfo -n lightInfo`;
  223.  
  224.     // connect the light to the lightInfo node.    
  225.     $attrR = $lightName[0] + ".worldMatrix";
  226.     $attrG = $lightInfoNode + ".worldMatrix";
  227.     connectAttr $attrR $attrG;
  228.  
  229.     // connect the lightInfoNode to the curve.
  230.     string $outDistance = $lightInfoNode + ".sampleDistance";
  231.     $attrR = $newCurveR + ".input";
  232.     $attrG = $newCurveG + ".input";
  233.     $attrB = $newCurveB + ".input";
  234.  
  235.     connectAttr $outDistance $attrR;
  236.     connectAttr $outDistance $attrG;
  237.     connectAttr $outDistance $attrB;
  238. }
  239.  
  240.  
  241. //
  242. //  Procedure Name:
  243. //    AEspotLightGlowNew
  244. //
  245. //
  246.  
  247. global proc AEspotLightGlowNew (string $lightGlow)
  248. {
  249.     setUITemplate -pst attributeEditorTemplate;
  250.  
  251.     attrNavigationControlGrp -l "Light Glow"
  252.         -at $lightGlow
  253.         -ignoreNotSupported
  254.         lightGlowControl;
  255.  
  256.     setUITemplate -ppt;
  257. }
  258.  
  259. //
  260. //  Procedure Name:
  261. //    AEspotLightGlowReplace
  262. //
  263. //
  264.  
  265. global proc AEspotLightGlowReplace (string $lightGlow)
  266. {
  267.     attrNavigationControlGrp -edit
  268.         -at $lightGlow
  269.         -ignoreNotSupported
  270.         lightGlowControl;
  271. }
  272.  
  273. //
  274. //  Procedure Name:
  275. //    AEspotLightEffects
  276. //
  277. //
  278.  
  279. global proc AEspotLightEffects ( string $nodeName )
  280. {
  281.     // Spot Light Glow Effects 
  282.     
  283.     editorTemplate -callCustom "AEspotLightGlowNew" 
  284.             "AEspotLightGlowReplace"
  285.              "lightGlow";
  286.  
  287.     // decay Region Effect
  288.  
  289.     editorTemplate -callCustom "AEdecayRegionNew"
  290.             "AEdecayRegionReplace"
  291.             "intensity";
  292.  
  293.     // Color Region Effect
  294.  
  295.     editorTemplate -callCustom "AEcolorRegionNew"
  296.             "AEcolorRegionReplace"
  297.             "colorR" 
  298.             "colorG" 
  299.             "colorB";
  300. }
  301.  
  302.  
  303.  
  304.